package com.wyz.saas.common.dialog

import android.app.Dialog
import android.content.Context
import android.content.DialogInterface
import android.view.View
import androidx.annotation.StringRes

class DialogConfig {
    abstract class One {

        var backupCancel = true
        var touchOutSideCancel = true

        @StringRes
        val positive: Int

        constructor(@StringRes positive: Int) {
            this.positive = positive
        }

        abstract fun onPositive(dialog: DialogInterface?)
    }

    abstract class Two : One {
        @StringRes
        val negative: Int

        constructor(@StringRes positive: Int, @StringRes negative: Int) : super(positive) {
            this.negative = negative
        }

        abstract fun onNegative(dialog: DialogInterface?)
    }

    abstract class Three : Two {
        @StringRes
        val neutral: Int

        constructor(
            @StringRes positive: Int,
            @StringRes negative: Int,
            @StringRes neutral: Int
        ) : super(
            positive,
            negative
        ) {
            this.neutral = neutral
        }

        abstract fun onNeutral(dialog: DialogInterface?)
    }

    interface Custom {
        fun view(ctx: Context): View
        fun onShow(dialog: Dialog): DialogInterface.OnShowListener? = null
        fun onDismiss(): DialogInterface.OnDismissListener? = null
        fun onCancel(): DialogInterface.OnCancelListener? = null
        fun onKey(): DialogInterface.OnKeyListener? = null
        fun onPos(): DialogInterface.OnClickListener? = null
        fun onNeg(): DialogInterface.OnClickListener? = null
        fun onNeu(): DialogInterface.OnClickListener? = null
    }
}